package com.etc.cloud.controller;

import com.etc.cloud.service.PaymentService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

import javax.ws.rs.GET;
import javax.ws.rs.Path;

/**
 * @Author kalista
 * @Description
 * @Date 2020/8/23  10:47
 **/
@RestController
@Slf4j
public class PaymentController {

    @Autowired
    private PaymentService paymentService;


    @GetMapping("/payment/hystrix/ok/{id}")
    public String payment_ok(@PathVariable Integer id){
        return paymentService.paymentinfo_ok(id);
    }

    @GetMapping("/payment/hystrix/timeout/{id}")
    public String payment_timeout(@PathVariable Integer id){
        return paymentService.paymentinfo_timeout(id);
    }


    /**
     * 熔断器
     * @param id
     * @return
     */
    @GetMapping("/payment/circuit/{id}")
    public String  paymentCircuitBreaker(@PathVariable("id") Integer id) {



        return paymentService.paymentCircuitBreaker(id);
    }

}
